Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect check if CI variable is set to true #2501

Merged
merged 2 commits into from
Jun 19, 2017
Merged

Fix incorrect check if CI variable is set to true #2501

merged 2 commits into from
Jun 19, 2017

Conversation

varnav
Copy link
Contributor

@varnav varnav commented Jun 8, 2017

Originally build would fail on warnings with any value of CI environment variable. Now it will correctly check if it's true.

Discussed here: #2453

Did a simple test with this shell script:

CI='true'
echo $CI
node -e "if (process.env.CI && process.env.CI.toLowerCase() === 'true') console.log('Yes')"

CI='True'
echo $CI
node -e "if (process.env.CI && process.env.CI.toLowerCase() === 'true') console.log('Yes')"

CI='false'
echo $CI
node -e "if (process.env.CI && process.env.CI.toLowerCase() === 'true') console.log('Yes')"

unset CI
echo $CI
node -e "if (process.env.CI && process.env.CI.toLowerCase() === 'true') console.log('Yes')"

Originally build would fail on warnings with any value of CI environment variable. Now it will correctly check if it's true.

Discussed here: #2453
@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Copy link
Contributor

@Timer Timer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one concern.

@@ -112,7 +112,7 @@ function build(previousFileSizes) {
if (messages.errors.length) {
return reject(new Error(messages.errors.join('\n\n')));
}
if (process.env.CI && messages.warnings.length) {
if (process.env.CI && process.env.CI.toLowerCase() === 'true' && messages.warnings.length) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling people might set this to things like travis, etc.

How about checking !== 'false'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about real practice of using this variable, I think we need some discussion first.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the way it works currently (truthy), using !== false would retain current functionality and wouldn't be a breaking change (if you consider 'false' a bug).

Even if 'true' is the proper value to evaluate against, we would have to postpone that to 2.0.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I agree then.

@Timer Timer added this to the 1.0.8 milestone Jun 8, 2017
After discussion we decided that this will be closer to current functionality and not break anything.
@varnav
Copy link
Contributor Author

varnav commented Jun 8, 2017

Oops, 2nd commit from me seems to be wrong.

@Timer
Copy link
Contributor

Timer commented Jun 19, 2017

Great, thanks for making that change!
Sorry for the slow turn around, I've been really busy lately.

@Timer Timer merged commit 5b38c54 into facebook:master Jun 19, 2017
@gaearon
Copy link
Contributor

gaearon commented Jun 28, 2017

romaindso pushed a commit to romaindso/create-react-app that referenced this pull request Jul 10, 2017
* Fix incorrect check if CI variable is set to true

Originally build would fail on warnings with any value of CI environment variable. Now it will correctly check if it's true.

Discussed here: facebook#2453

* Check for "not false" instead of "not true"

After discussion we decided that this will be closer to current functionality and not break anything.
wmonk referenced this pull request in wmonk/create-react-app-typescript Aug 7, 2017
* Fix incorrect check if CI variable is set to true

Originally build would fail on warnings with any value of CI environment variable. Now it will correctly check if it's true.

Discussed here: facebook/create-react-app#2453

* Check for "not false" instead of "not true"

After discussion we decided that this will be closer to current functionality and not break anything.
@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants